<template>
  <el-tabs :tab-position="tabPosition" style="height: auto;background-color: #ffffff">
    <h3>历史性能统计</h3>
    <el-form :model="data" label-width="60px" ref="filterForm">
      <el-row>
        <el-col :span="12">
          <MeEqPtp/>
        </el-col>
        <el-col :span="3">
          <el-form-item label="周期" prop="port">
            <el-select v-model="getHistoryPerformances.granularity" placeholder="请选择周期" clearable style="width: 100%">
              <el-option value="15min"></el-option>
              <el-option value="24h"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="6px">
            <el-date-picker
                v-model="data.appoint.date"
                type="datetimerange"
                :picker-options="pickerOptions"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                align="right">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item>
            <el-button type="primary" style="margin-left: 100px">确认</el-button>
            <el-button @click="resetForm('getHistoryPerformances')">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <el-tab-pane label="设备性能">

      <Others/>

    </el-tab-pane>
    <el-tab-pane label="光接口">

      <OPTStatistics/>


    </el-tab-pane>
    <el-tab-pane label="g.metro">

      <GmetroStatistics/>

    </el-tab-pane>
    <el-tab-pane label="以太网端口">

      <EthStatistics/>

    </el-tab-pane>
    <el-tab-pane label="以太网OAM">

      <EthClientStatistics/>

    </el-tab-pane>


    <el-tab-pane label="SDH再生段">

      <SdhRs/>

    </el-tab-pane>
    <el-tab-pane label="ODUk PM">

      <ODUkPM/>

    </el-tab-pane>
    <el-tab-pane label="ODUk TCM">

      <ODUkTCM/>

    </el-tab-pane>
    <el-tab-pane label="OTU SM">

      <OTUSM/>

    </el-tab-pane>


  </el-tabs>
</template>

<script>
import EthStatistics from "@/components/statistics/EthStatistics";
import EthClientStatistics from "@/components/statistics/EthClientStatistics";
import OPTStatistics from "@/components/statistics/OPTStatistics";
import GmetroStatistics from "@/components/statistics/GmetroStatistics";
import SdhRs from "@/components/statistics/SdhRs";
import ODUkPM from "@/components/statistics/ODUkPM";
import ODUkTCM from "@/components/statistics/ODUkTCM";
import OTUSM from "@/components/statistics/OTUSM";
import Others from "@/components/statistics/Others";
import MeEqPtp from "@/components/common/MeEqPtp";

export default {
  name: "MEHistoryPerformanceStatistics",
  components: {
    MeEqPtp,
    EthStatistics,
    EthClientStatistics,
    OPTStatistics,
    GmetroStatistics,
    SdhRs,
    ODUkPM,
    ODUkTCM,
    OTUSM,
    Others
  },
  data() {
    return {
      tabPosition: 'left',
      data: {
        me: '',
        slot: '',
        port: '',
        appoint: {
          date: '',
          time: ''
        },
        endTime: {
          date: '',
          time: ''
        }
      },
      granularity: ['1min', '15min', '24h'],
      getHistoryPerformances: {
        objectName: '',
        granularity: '',
        pmParameterName: '',
        starTime: {
          date1: '',
          date2: '',
        },
        endTime: {
          date1: '',
          date2: '',
        },
      },
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },

      options: [
        {
          value: '',
          label: '以太网端口性能',
          children: [
            {
              value: 'RX_PKT_SUM',
              label: '接收的正常包数',
            },
            {
              value: 'rxBytes',
              label: '接收的正常包字节总数'
            },
            {
              value: 'RX_SUMMIT_1S',
              label: '接收的秒级峰值'
            },
            {
              value: 'TX_PKT_SUM',
              label: '发送的正常包数'
            },
            {
              value: 'txBytes',
              label: '发送的正常包字节总数'
            },
            {
              value: 'TX_SUMMIT_1S',
              label: '发送的秒级峰值'
            },
            {
              value: 'RX_CRC_ERR_SUM',
              label: '接收CRC错包数'
            },
          ]
        },
        {
          value: '',
          label: '以太客户层业务性能',
          children: [
            {
              value: 'delay',
              label: '双向时延'
            },
            {
              value: 'nearPacketLossRate',
              label: '近端丢包率'
            },
            {
              value: 'farPacketLossRate',
              label: '远端丢包率'
            },
          ]
        },
        {
          value: '',
          label: '光接口',
          children: [
            {
              value: 'OPT_OUTPOW',
              label: '输出光功率'
            },
            {
              value: 'OPT_INPUTPOW',
              label: '输入光功率'
            },
            {
              value: 'LD_BIAS',
              label: '激光器偏流'
            },
            {
              value: 'LASER_TMP',
              label: '激光器温度'
            },
            {
              value: 'LASER_FREQUNCY',
              label: '激光器频率'
            },
          ]
        },
        {
          value: '',
          label: 'g.metro',
          children: [
            {
              value: 'TEE_LINE_TXPOWER',
              label: 'TEE输出光功率'
            },
            {
              value: 'TEE_LINE_RXPOWER',
              label: 'TEE输入光功率'
            },
            {
              value: 'TEE_LINE_BIAS_CURRENT',
              label: 'TEE激光器偏流'
            },
            {
              value: 'TEE_LINE_TEMPERATURE',
              label: 'TEE激光器温度'
            },
            {
              value: 'TEE_LINE_LASER_FREQUNCY',
              label: 'TEE激光器频率'
            },
            {
              value: 'TEE_CLIENT_TXPOWER',
              label: 'TEE CLIENT输出光功率'
            },
            {
              value: 'TEE_CLIENT_RXPOWER',
              label: 'TEE CLIENT输入光功率'
            },
            {
              value: 'TEE_CLIENT_BIAS_CURRENT',
              label: 'TEE CLIENT激光器偏流'
            },
            {
              value: 'TEE_CLIENT_TEMPERATURE',
              label: 'TEE CLIENT激光器温度'
            },
            {
              value: 'TEE_CLIENT_LASER_FREQUNCY',
              label: 'TEE CLIENT激光器频率'
            },
          ]
        },
        {
          value: '',
          label: 'SDH业务再生段性能',
          children: [
            {
              value: 'RS_ES',
              label: 'RS误码秒'
            },
            {
              value: 'RS_SES',
              label: 'RS严重误码秒'
            },
            {
              value: 'RS_UAS',
              label: 'RS不可用时间'
            },
            {
              value: 'RS_CV',
              label: 'RS误码数'
            },
            {
              value: 'RS_BBE',
              label: 'RS BBE背景块误码个数'
            },
          ]
        },
        {
          value: '',
          label: 'ODUk的PM性能',
          children: [
            {
              value: 'PM_BBE',
              label: 'PM 背景块误码'
            },
            {
              value: 'PM_BBER',
              label: 'PM 背景块误码比（可选）'
            },
            {
              value: 'PM_ES',
              label: 'PM 误码秒'
            },
            {
              value: 'PM_SES',
              label: 'PM 严重误码秒'
            },
            {
              value: 'PM_SESR',
              label: 'PM 严重误码秒比（可选）'
            },
            {
              value: 'PM_UAS',
              label: 'PM 不可用秒'
            },
            {
              value: 'PM_FEBBE',
              label: 'PM 远端背景块误码'
            },
            {
              value: 'PM_FEBBER',
              label: 'PM 远端背景块误码比（可选）'
            },
            {
              value: 'PM_FEESPM_FEES',
              label: 'PM 远端误码秒'
            },
            {
              value: 'PM_FESES',
              label: 'PM 远端严重误码秒'
            },
            {
              value: 'PM_FEUAS',
              label: 'PM 远端不可用秒'
            },
            {
              value: 'PM_FESESR',
              label: 'PM 远端严重误码秒比（可选）'
            },
          ]
        },
        {
          value: '',
          label: 'ODUk的TCM 性能\n' +
              '（仅适用于插卡式设备）',
          children: [
            {
              value: 'TCMi_BBE',
              label: 'TCMi 背景误码块'
            },
            {
              value: 'TCMi_BBER',
              label: 'TCMi 背景误码块比（可选）'
            },
            {
              value: 'TCMi_BIAES',
              label: 'TCMi 后向输入定位误码秒'
            },
            {
              value: 'TCMi_IAES',
              label: 'TCMi 输入定位误码秒'
            },
            {
              value: 'TCMi_ES',
              label: 'TCMi 误码秒'
            },
            {
              value: 'TCMi_SES',
              label: 'TCMi 严重误码秒'
            },
            {
              value: 'TCMi_SESR',
              label: 'TCMi 严重误码秒比（可选）'
            },
            {
              value: 'TCMi_UAS',
              label: 'TCMi 不可用秒'
            },
            {
              value: 'TCMi_FEBBE',
              label: 'TCMi 远端背景块误码'
            },
            {
              value: 'TCMi_FEBBER',
              label: 'TCMi 远端背景块误码比（可选）'
            },
            {
              value: 'TCMi_FEES',
              label: 'TCMi 远端误码秒'
            },
            {
              value: 'TCMi_FESES',
              label: 'TCMi 远端严重误码秒'
            },
            {
              value: 'TCMi_FESESR',
              label: 'TCMi 远端严重误码秒比（可选）'
            },
            {
              value: 'TCMi_FEUAS',
              label: 'TCMi 远端不可用秒'
            },
          ]
        },
        {
          value: '',
          label: 'OTU SM段性能',
          children: [
            {
              value: 'SM_BBE',
              label: 'SM 背景误码块'
            },
            {
              value: 'SM_BBER',
              label: 'SM 背景误码块比（可选）'
            },
            {
              value: 'SM_BIAES',
              label: 'SM 后向输入定位误码秒'
            },
            {
              value: 'SM_IAES',
              label: 'SM 输入定位误码秒'
            },
            {
              value: 'SM_ES',
              label: 'SM 误码秒'
            },
            {
              value: 'SM_SES',
              label: 'SM 严重误码秒'
            },
            {
              value: 'SM_SESR',
              label: 'SM 严重误码秒比（可选）'
            },
            {
              value: 'SM_UAS',
              label: 'SM 不可用秒'
            },
            {
              value: 'SM_FEBBE',
              label: 'SM 远端背景块误码'
            },
            {
              value: 'SM_FEBBER',
              label: 'SM 远端背景块误码比（可选）'
            },
            {
              value: 'SM_FEES',
              label: 'SM 远端误码秒'
            },
            {
              value: 'SM_FESES',
              label: 'SM 远端严重误码秒'
            },
            {
              value: 'SM_FESESR',
              label: 'SM 远端严重误码秒比（可选）'
            },
            {
              value: 'SM_FEUAS',
              label: 'SM 远端不可用秒'
            },
            {
              value: 'FEC_CORRECT_ERROR',
              label: 'FEC纠正的误码数'
            },
            {
              value: 'UNCORRECT_FRAME',
              label: 'FEC不可纠正的帧'
            },
            {
              value: 'BER_BEFORE_FEC',
              label: 'FEC纠错前误码率'
            },
          ]
        },
        {
          value: '',
          label: '其他性能',
          children: [
            {
              value: 'BRD_CPU_USAGE',
              label: '板卡CPU利用率'
            },
            {
              value: 'BRD_MEMORY_USAGE',
              label: '板卡内存利用率'
            },
          ]
        },
      ],
    };
  },
  methods: {
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
}
</script>

<style scoped>

</style>